* Spatial Mismatch estimation, by Mark Kutzbach
set more off
set linesize 140

* used to run partial correlations
do pcorrmat.do

clear
set mem 1g

set matsize 2000

* paths
include "path.do"
display "Analysis for Vintage name: ${vint}"

* set version number and run name
local vnum="58"
local vers="run_describe"

* log starts here
log using mismatch_`vnum'_`vers'.smcl, replace
********************** Load Data ********************

* load csv produced from sas processing
cd "$progdir/$vint"
insheet using "$datadir/$vint/lostjob_analysis.csv", comma

* retain only those who were actually displaced
keep if displaced_ever_nosp_25==1
describe
********************** Prepare Data ********************

do mismatch_`vnum'_setup.do
********************** Summarize Data ********************

* explanatory variables
local control_sex="female"
local control_grp="grp_black grp_hisp grp_other"
local control_age="age_20_24 age_35_44 age_45_54 age_55_64"
local control_earn="earntotallhuln earntotallln earndomln earndomsepln"
local control_job="tenuredom jobcount_hist sep_time_0020 sep_time_40up"
local control_sec="sec_sep_retl sec_sep_prof sec_sep_educ sec_sep_heal"
local control_hood="poverty_rate owner_rate pop_sq_mile build_age_med"
local control_year="sep_2001 sep_2002 sep_2003 sep_2004 sep_2005"
local control_seas="sep_seas_2 sep_seas_3 sep_seas_4"
local control_met="inind midet ohcol ohcle mnmin papit nybuf wimil"

* controls
local contstand="`control_sex' `control_grp' `control_age' `control_earn' `control_job' `control_hood'"

* dependent variables
local depvar="qtr_hire_earndom_75"

* job accessibility
local jobaccess="ratio_predfeas_all_10"

* other
local othervar="puma5 h_stfid seindom sep_year grp_c sep_sec_c primeearn age_c3 earn_c femy_fe*"

describe `depvar' `jobaccess' `contstand' `control_sec' `control_seas' `control_year' `othervar', fullnames

codebook `depvar' `jobaccess' `contstand' `control_sec' `control_seas' `control_year' `othervar', detail

***************************************************************
* end of results
log close

* translate results
translate mismatch_`vnum'_`vers'.smcl mismatch_`vnum'_`vers'.txt, replace

